package com.member.common.enums;


import lombok.Getter;

import java.util.Objects;
@Getter
public enum OrderSatusEnum {
    PENDING_PAYMENT(10, "待支付"),
    PAYMENT_SUCCESS(15, "已支付"),
    TO_BE_SHIPPED(20, "待发货"),
    TO_BE_RECEIVED(30, "已发货"),
    RECEIVED(40, "已完成"),
    CANCELLED(90, "已取消"),
    AFTER_SALES_PROCESSING(80, "售后中"),
    AFTER_SALES_SUCCESS(85, "售后成功"),
    AFTER_SALES_FAILURE(88, "售后失败");

    private final Integer key;
    private final String desc;

    OrderSatusEnum(Integer key, String desc) {
        this.key = key;
        this.desc = desc;
    }

    public static OrderSatusEnum getByKey(Integer key){
        for (OrderSatusEnum item : OrderSatusEnum.values()){
            if(Objects.equals(item.getKey(), key)){
                return item;
            }
        }
        return null;
    }

}
